<template>
<div>
  <h1>登录页面</h1>
  <p>登录账号：<input type="text" v-model=form.username></p>
  <p>登录密码：<input type="text" v-model="form.password"></p>
  <button @click="add_user">登录</button>
</div>
</template>

<script>
export default {
  name: "users",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    add_user(){
      this.$axios.post('users/AshopAPI/',this.form)
      .then(res=>{
        if(res.data.code==200){
          localStorage.setItem('userid',res.data.userid)
          this.$router.push({path:'/shop'})
        }else {
          alert(res.data.mes)
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
